﻿/*
结点更新任务执行
*/
var arrNodeTask = new Array();
var _node_task_run = false;
var _node_task_id = 0;
function run_task() {
    for (var i = 0; i < node_task_dataArray.length; i++) {//总任务-begin
        taskData = node_task_dataArray[i];

        if (taskData.bind == 1)
            continue;

        if (taskData.bind == 0) {//分解一个总任务-begin
            taskData.bind = 1;
            if (taskData) {
                var items = taskData.items;
                for (var id in items) {
                    var info = items[id];
                    arrNodeTask.push(info);
                }
            }
        }

    }
    _add_node_task = false;
    exec_node_task();
}

function exec_node_task() {
    if (_node_task_run) { return; }
    _node_task_run = true;
    node_task_run();
}

function node_task_run() {
    //document.title = _node_task_id;//测试判断循环
    if (_node_task_id <= arrNodeTask.length - 1) {
        var taskInfoTemp = arrNodeTask[_node_task_id];
        //alert(taskInfoTemp.exec);
        if (taskInfoTemp && taskInfoTemp.exec == 0) {
            if (_node_task_id == 0) {
                top.frames["Anti_refresh"].location = 'publish/admin_node_task.aspx?_node_task_id=' + _node_task_id + '&t=' + Math.random();
            }
            else {
                top.frames["Anti_refresh"].location = 'admin_node_task.aspx?_node_task_id=' + _node_task_id + '&t=' + Math.random();
            }
            //  alert(top.frames["Anti_refresh"].location);
        }
        else {
            _node_task_id++;
            node_task_run();
        }
    }
    else {
        while (arrNodeTask.pop()) { }
        _node_task_id = 0;
        _node_task_run = false;
    }
} 
